<template>
  <div class="hometop">
    <div class="title animate__animated animate__heartBeat">橙色营养师</div>
    <div
      class="hometopinp"
      @click="
        $router.push({ path: '/search' });
        sofoodbank(false);
      "
    >
      <span class="search"><img src="../assets/image/icon_search.png" /></span>
      <span class="hometoptext">请输入食物名称</span>
      <span class="sao" @click.stop="$router.push({ path: '/dlzong' })"
        ><img src="../assets/image/search_sao.png"
      /></span>
    </div>
    <div class="hometopbottom">
      <div
        class="homtbimg"
        @click="
          $router.push({ path: '/foodscontrast' });
          sofoodbank(true);
        "
      >
        <span><img src="../assets/image/ic_scan_code_comparison_v1.png" /></span
        ><span>食物对比</span>
      </div>
      <div
        class="homtbimg"
        @click="$router.push({ path: '/foodrankingboard' })"
      >
        <span><img src="../assets/image/ic_home_list.png" /></span>
        <span>食物排行版</span>
      </div>
      <div class="homtbimg" @click="$router.push({ path: '/dlzong' })">
        <img src="../assets/image/ic_search_comparison.png" />
        <span>配料识别</span>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  methods: {
    ...mapMutations(["sofoodbank"]),
  },
};
</script>

<style lang="less" scoped>
.hometop {
  width: 100vw;
  height: 25vh;
  background-image: url("../assets/image/img_home_bg.jpg");
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  .title {
    padding-top: 10px;
    text-align: center;
    font-weight: bold;
    color: white;
  }
  .hometopinp {
    margin-top: 30px;
    width: 90%;
    height: 40px;
    border-radius: 10px;
    background-color: white;
    display: flex;
    align-items: center;
    .search {
      display: block;
      width: 15px;
      margin: 0 6px;
      img {
        width: 100%;
        vertical-align: middle;
      }
    }
    .hometoptext {
      flex: 1;
      color: rgba(128, 128, 128, 0.541);
      font-size: 12px;
    }
    .sao {
      display: block;
      width: 15px;
      margin: 0 5px;
    }
    span {
      img {
        vertical-align: middle;
      }
    }
  }
  .hometopbottom {
    display: flex;
    color: white;
    justify-content: space-between;
    width: 70%;
    .homtbimg {
      display: flex;
      align-items: center;
      margin-top: 25px;
      img {
        width: 18px;
      }
      span {
        margin-left: 5px;
        font-size: 12px;
      }
    }
  }
}
</style>